package o;

import android.content.Context;
import com.huawei.appgallery.datastorage.database.AbsDataDAO;
import com.huawei.appgallery.packagemanager.api.bean.ProfileTask;
import com.huawei.appgallery.packagemanager.impl.storage.PmDataBase;
import java.util.ArrayList;
import java.util.List;

public class cor extends AbsDataDAO {
    private static final Object ˊ = new Object();
    private static cor ˋ = null;

    private cor(Context context) {
        super(context, PmDataBase.class, ProfileTask.class);
    }

    public static cor ˎ(Context context) {
        cor o_cor;
        synchronized (ˊ) {
            if (ˋ == null) {
                ˋ = new cor(context);
            }
            o_cor = ˋ;
        }
        return o_cor;
    }

    public void ॱ(String str) {
        this.ˏ.ˎ("packageName=?", new String[]{str});
    }

    public void ˏ(ProfileTask profileTask) {
        this.ˏ.ˊ((blw) profileTask);
    }

    public void ˊ(ProfileTask profileTask) {
        this.ˏ.ˎ(profileTask, "packageName=? and versionCode=?", new String[]{profileTask.packageName, String.valueOf(profileTask.versionCode)});
    }

    public List<ProfileTask> ˊ(String str, String str2, String str3, String str4) {
        List arrayList = new ArrayList();
        String str5 = "packageName=?";
        arrayList.add(str);
        if (str2 != null) {
            str5 = str5 + " and versionCode=?";
            arrayList.add(str2);
        }
        if (str3 != null) {
            str5 = str5 + " and profileUrl=?";
            arrayList.add(str3);
        }
        if (str4 != null) {
            str5 = str5 + "and sha256=?";
            arrayList.add(str4);
        }
        return this.ˏ.ˊ(ProfileTask.class, str5, (String[]) arrayList.toArray(new String[arrayList.size()]), null, null, "status DESC");
    }
}
